#ifndef THINK_THINK_ROUTE_H
#define THINK_THINK_ROUTE_H

static char* think_route =
	"\n"
	"// +----------------------------------------------------------------------\n"
	"// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n"
	"// +----------------------------------------------------------------------\n"
	"// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.\n"
	"// +----------------------------------------------------------------------\n"
	"// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n"
	"// +----------------------------------------------------------------------\n"
	"// | Author: liu21st <liu21st@gmail.com>\n"
	"// +----------------------------------------------------------------------\n"
	"\n"
	"namespace think;\n"
	"\n"
	"use think\\exception\\HttpException;\n"
	"\n"
	"class Route\n"
	"{\n"
	"    // 路由规则\n"
	"    private static $rules = [\n"
	"        \'get\'     => [],\n"
	"        \'post\'    => [],\n"
	"        \'put\'     => [],\n"
	"        \'delete\'  => [],\n"
	"        \'patch\'   => [],\n"
	"        \'head\'    => [],\n"
	"        \'options\' => [],\n"
	"        \'*\'       => [],\n"
	"        \'alias\'   => [],\n"
	"        \'domain\'  => [],\n"
	"        \'pattern\' => [],\n"
	"        \'name\'    => [],\n"
	"    ];\n"
	"\n"
	"    // REST路由操作方法定义\n"
	"    private static $rest = [\n"
	"        \'index\'  => [\'get\', \'\', \'index\'],\n"
	"        \'create\' => [\'get\', \'/create\', \'create\'],\n"
	"        \'edit\'   => [\'get\', \'/:id/edit\', \'edit\'],\n"
	"        \'read\'   => [\'get\', \'/:id\', \'read\'],\n"
	"        \'save\'   => [\'post\', \'\', \'save\'],\n"
	"        \'update\' => [\'put\', \'/:id\', \'update\'],\n"
	"        \'delete\' => [\'delete\', \'/:id\', \'delete\'],\n"
	"    ];\n"
	"\n"
	"    // 不同请求类型的方法前缀\n"
	"    private static $methodPrefix = [\n"
	"        \'get\'    => \'get\',\n"
	"        \'post\'   => \'post\',\n"
	"        \'put\'    => \'put\',\n"
	"        \'delete\' => \'delete\',\n"
	"        \'patch\'  => \'patch\',\n"
	"    ];\n"
	"\n"
	"    // 子域名\n"
	"    private static $subDomain = \'\';\n"
	"    // 域名绑定\n"
	"    private static $bind = [];\n"
	"    // 当前分组信息\n"
	"    private static $group = [];\n"
	"    // 当前子域名绑定\n"
	"    private static $domainBind;\n"
	"    private static $domainRule;\n"
	"    // 当前域名\n"
	"    private static $domain;\n"
	"    // 当前路由执行过程中的参数\n"
	"    private static $option = [];\n"
	"\n"
	"    /**\n"
	"     * 注册变量规则\n"
	"     * @access public\n"
	"     * @param string|array $name 变量名\n"
	"     * @param string       $rule 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function pattern($name = null, $rule = \'\')\n"
	"    {\n"
	"        if (is_array($name)) {\n"
	"            self::$rules[\'pattern\'] = array_merge(self::$rules[\'pattern\'], $name);\n"
	"        } else {\n"
	"            self::$rules[\'pattern\'][$name] = $rule;\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册子域名部署规则\n"
	"     * @access public\n"
	"     * @param string|array $domain  子域名\n"
	"     * @param mixed        $rule    路由规则\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function domain($domain, $rule = \'\', $option = [], $pattern = [])\n"
	"    {\n"
	"        if (is_array($domain)) {\n"
	"            foreach ($domain as $key => $item) {\n"
	"                self::domain($key, $item, $option, $pattern);\n"
	"            }\n"
	"        } elseif ($rule instanceof \\Closure) {\n"
	"            // 执行闭包\n"
	"            self::setDomain($domain);\n"
	"            call_user_func_array($rule, []);\n"
	"            self::setDomain(null);\n"
	"        } elseif (is_array($rule)) {\n"
	"            self::setDomain($domain);\n"
	"            self::group(\'\', function () use ($rule) {\n"
	"                // 动态注册域名的路由规则\n"
	"                self::registerRules($rule);\n"
	"            }, $option, $pattern);\n"
	"            self::setDomain(null);\n"
	"        } else {\n"
	"            self::$rules[\'domain\'][$domain][\'[bind]\'] = [$rule, $option, $pattern];\n"
	"        }\n"
	"    }\n"
	"\n"
	"    private static function setDomain($domain)\n"
	"    {\n"
	"        self::$domain = $domain;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置路由绑定\n"
	"     * @access public\n"
	"     * @param mixed  $bind 绑定信息\n"
	"     * @param string $type 绑定类型 默认为module 支持 namespace class controller\n"
	"     * @return mixed\n"
	"     */\n"
	"    public static function bind($bind, $type = \'module\')\n"
	"    {\n"
	"        self::$bind = [\'type\' => $type, $type => $bind];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置或者获取路由标识\n"
	"     * @access public\n"
	"     * @param string|array $name  路由命名标识 数组表示批量设置\n"
	"     * @param array        $value 路由地址及变量信息\n"
	"     * @return array\n"
	"     */\n"
	"    public static function name($name = \'\', $value = null)\n"
	"    {\n"
	"        if (is_array($name)) {\n"
	"            return self::$rules[\'name\'] = $name;\n"
	"        } elseif (\'\' === $name) {\n"
	"            return self::$rules[\'name\'];\n"
	"        } elseif (!is_null($value)) {\n"
	"            self::$rules[\'name\'][strtolower($name)][] = $value;\n"
	"        } else {\n"
	"            $name = strtolower($name);\n"
	"            return isset(self::$rules[\'name\'][$name]) ? self::$rules[\'name\'][$name] : null;\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 读取路由绑定\n"
	"     * @access public\n"
	"     * @param string $type 绑定类型\n"
	"     * @return mixed\n"
	"     */\n"
	"    public static function getBind($type)\n"
	"    {\n"
	"        return isset(self::$bind[$type]) ? self::$bind[$type] : null;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 导入配置文件的路由规则\n"
	"     * @access public\n"
	"     * @param array  $rule 路由规则\n"
	"     * @param string $type 请求类型\n"
	"     * @return void\n"
	"     */\n"
	"    public static function import(array $rule, $type = \'*\')\n"
	"    {\n"
	"        // 检查域名部署\n"
	"        if (isset($rule[\'__domain__\'])) {\n"
	"            self::domain($rule[\'__domain__\']);\n"
	"            unset($rule[\'__domain__\']);\n"
	"        }\n"
	"\n"
	"        // 检查变量规则\n"
	"        if (isset($rule[\'__pattern__\'])) {\n"
	"            self::pattern($rule[\'__pattern__\']);\n"
	"            unset($rule[\'__pattern__\']);\n"
	"        }\n"
	"\n"
	"        // 检查路由别名\n"
	"        if (isset($rule[\'__alias__\'])) {\n"
	"            self::alias($rule[\'__alias__\']);\n"
	"            unset($rule[\'__alias__\']);\n"
	"        }\n"
	"\n"
	"        // 检查资源路由\n"
	"        if (isset($rule[\'__rest__\'])) {\n"
	"            self::resource($rule[\'__rest__\']);\n"
	"            unset($rule[\'__rest__\']);\n"
	"        }\n"
	"\n"
	"        self::registerRules($rule, strtolower($type));\n"
	"    }\n"
	"\n"
	"    // 批量注册路由\n"
	"    protected static function registerRules($rules, $type = \'*\')\n"
	"    {\n"
	"        foreach ($rules as $key => $val) {\n"
	"            if (is_numeric($key)) {\n"
	"                $key = array_shift($val);\n"
	"            }\n"
	"            if (empty($val)) {\n"
	"                continue;\n"
	"            }\n"
	"            if (is_string($key) && 0 === strpos($key, \'[\')) {\n"
	"                $key = substr($key, 1, -1);\n"
	"                self::group($key, $val);\n"
	"            } elseif (is_array($val)) {\n"
	"                self::setRule($key, $val[0], $type, $val[1], isset($val[2]) ? $val[2] : []);\n"
	"            } else {\n"
	"                self::setRule($key, $val, $type);\n"
	"            }\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册路由规则\n"
	"     * @access public\n"
	"     * @param string|array $rule    路由规则\n"
	"     * @param string       $route   路由地址\n"
	"     * @param string       $type    请求类型\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function rule($rule, $route = \'\', $type = \'*\', $option = [], $pattern = [])\n"
	"    {\n"
	"        $group = self::getGroup(\'name\');\n"
	"\n"
	"        if (!is_null($group)) {\n"
	"            // 路由分组\n"
	"            $option  = array_merge(self::getGroup(\'option\'), $option);\n"
	"            $pattern = array_merge(self::getGroup(\'pattern\'), $pattern);\n"
	"        }\n"
	"\n"
	"        $type = strtolower($type);\n"
	"\n"
	"        if (strpos($type, \'|\')) {\n"
	"            $option[\'method\'] = $type;\n"
	"            $type             = \'*\';\n"
	"        }\n"
	"        if (is_array($rule) && empty($route)) {\n"
	"            foreach ($rule as $key => $val) {\n"
	"                if (is_numeric($key)) {\n"
	"                    $key = array_shift($val);\n"
	"                }\n"
	"                if (is_array($val)) {\n"
	"                    $route    = $val[0];\n"
	"                    $option1  = array_merge($option, $val[1]);\n"
	"                    $pattern1 = array_merge($pattern, isset($val[2]) ? $val[2] : []);\n"
	"                } else {\n"
	"                    $option1  = null;\n"
	"                    $pattern1 = null;\n"
	"                    $route    = $val;\n"
	"                }\n"
	"                self::setRule($key, $route, $type, !is_null($option1) ? $option1 : $option, !is_null($pattern1) ? $pattern1 : $pattern, $group);\n"
	"            }\n"
	"        } else {\n"
	"            self::setRule($rule, $route, $type, $option, $pattern, $group);\n"
	"        }\n"
	"\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置路由规则\n"
	"     * @access public\n"
	"     * @param string|array $rule    路由规则\n"
	"     * @param string       $route   路由地址\n"
	"     * @param string       $type    请求类型\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @param string       $group   所属分组\n"
	"     * @return void\n"
	"     */\n"
	"    protected static function setRule($rule, $route, $type = \'*\', $option = [], $pattern = [], $group = \'\')\n"
	"    {\n"
	"        if (is_array($rule)) {\n"
	"            $name = $rule[0];\n"
	"            $rule = $rule[1];\n"
	"        } elseif (is_string($route)) {\n"
	"            $name = $route;\n"
	"        }\n"
	"        if (!isset($option[\'complete_match\'])) {\n"
	"            if (Config::get(\'route_complete_match\')) {\n"
	"                $option[\'complete_match\'] = true;\n"
	"            } elseif (\'$\' == substr($rule, -1, 1)) {\n"
	"                // 是否完整匹配\n"
	"                $option[\'complete_match\'] = true;\n"
	"            }\n"
	"        } elseif (empty($option[\'complete_match\']) && \'$\' == substr($rule, -1, 1)) {\n"
	"            // 是否完整匹配\n"
	"            $option[\'complete_match\'] = true;\n"
	"        }\n"
	"\n"
	"        if (\'$\' == substr($rule, -1, 1)) {\n"
	"            $rule = substr($rule, 0, -1);\n"
	"        }\n"
	"\n"
	"        if (\'/\' != $rule || $group) {\n"
	"            $rule = trim($rule, \'/\');\n"
	"        }\n"
	"        $vars = self::parseVar($rule);\n"
	"        if (isset($name)) {\n"
	"            $key    = $group ? $group . ($rule ? \'/\' . $rule : \'\') : $rule;\n"
	"            $suffix = isset($option[\'ext\']) ? $option[\'ext\'] : null;\n"
	"            self::name($name, [$key, $vars, self::$domain, $suffix]);\n"
	"        }\n"
	"        if (isset($option[\'modular\'])) {\n"
	"            $route = $option[\'modular\'] . \'/\' . $route;\n"
	"        }\n"
	"        if ($group) {\n"
	"            if (\'*\' != $type) {\n"
	"                $option[\'method\'] = $type;\n"
	"            }\n"
	"            if (self::$domain) {\n"
	"                self::$rules[\'domain\'][self::$domain][\'*\'][$group][\'rule\'][] = [\'rule\' => $rule, \'route\' => $route, \'var\' => $vars, \'option\' => $option, \'pattern\' => $pattern];\n"
	"            } else {\n"
	"                self::$rules[\'*\'][$group][\'rule\'][] = [\'rule\' => $rule, \'route\' => $route, \'var\' => $vars, \'option\' => $option, \'pattern\' => $pattern];\n"
	"            }\n"
	"        } else {\n"
	"            if (\'*\' != $type && isset(self::$rules[\'*\'][$rule])) {\n"
	"                unset(self::$rules[\'*\'][$rule]);\n"
	"            }\n"
	"            if (self::$domain) {\n"
	"                self::$rules[\'domain\'][self::$domain][$type][$rule] = [\'rule\' => $rule, \'route\' => $route, \'var\' => $vars, \'option\' => $option, \'pattern\' => $pattern];\n"
	"            } else {\n"
	"                self::$rules[$type][$rule] = [\'rule\' => $rule, \'route\' => $route, \'var\' => $vars, \'option\' => $option, \'pattern\' => $pattern];\n"
	"            }\n"
	"            if (\'*\' == $type) {\n"
	"                // 注册路由快捷方式\n"
	"                foreach ([\'get\', \'post\', \'put\', \'delete\', \'patch\', \'head\', \'options\'] as $method) {\n"
	"                    if (self::$domain && !isset(self::$rules[\'domain\'][self::$domain][$method][$rule])) {\n"
	"                        self::$rules[\'domain\'][self::$domain][$method][$rule] = true;\n"
	"                    } elseif (!self::$domain && !isset(self::$rules[$method][$rule])) {\n"
	"                        self::$rules[$method][$rule] = true;\n"
	"                    }\n"
	"                }\n"
	"            }\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置当前执行的参数信息\n"
	"     * @access public\n"
	"     * @param array $options 参数信息\n"
	"     * @return mixed\n"
	"     */\n"
	"    protected static function setOption($options = [])\n"
	"    {\n"
	"        self::$option[] = $options;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取当前执行的所有参数信息\n"
	"     * @access public\n"
	"     * @return array\n"
	"     */\n"
	"    public static function getOption()\n"
	"    {\n"
	"        return self::$option;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取当前的分组信息\n"
	"     * @access public\n"
	"     * @param string $type 分组信息名称 name option pattern\n"
	"     * @return mixed\n"
	"     */\n"
	"    public static function getGroup($type)\n"
	"    {\n"
	"        if (isset(self::$group[$type])) {\n"
	"            return self::$group[$type];\n"
	"        } else {\n"
	"            return \'name\' == $type ? null : [];\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置当前的路由分组\n"
	"     * @access public\n"
	"     * @param string $name    分组名称\n"
	"     * @param array  $option  分组路由参数\n"
	"     * @param array  $pattern 分组变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function setGroup($name, $option = [], $pattern = [])\n"
	"    {\n"
	"        self::$group[\'name\']    = $name;\n"
	"        self::$group[\'option\']  = $option ?: [];\n"
	"        self::$group[\'pattern\'] = $pattern ?: [];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册路由分组\n"
	"     * @access public\n"
	"     * @param string|array   $name    分组名称或者参数\n"
	"     * @param array|\\Closure $routes  路由地址\n"
	"     * @param array          $option  路由参数\n"
	"     * @param array          $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function group($name, $routes, $option = [], $pattern = [])\n"
	"    {\n"
	"        if (is_array($name)) {\n"
	"            $option = $name;\n"
	"            $name   = isset($option[\'name\']) ? $option[\'name\'] : \'\';\n"
	"        }\n"
	"        // 分组\n"
	"        $currentGroup = self::getGroup(\'name\');\n"
	"        if ($currentGroup) {\n"
	"            $name = $currentGroup . ($name ? \'/\' . ltrim($name, \'/\') : \'\');\n"
	"        }\n"
	"        if (!empty($name)) {\n"
	"            if ($routes instanceof \\Closure) {\n"
	"                $currentOption  = self::getGroup(\'option\');\n"
	"                $currentPattern = self::getGroup(\'pattern\');\n"
	"                self::setGroup($name, array_merge($currentOption, $option), array_merge($currentPattern, $pattern));\n"
	"                call_user_func_array($routes, []);\n"
	"                self::setGroup($currentGroup, $currentOption, $currentPattern);\n"
	"                if ($currentGroup != $name) {\n"
	"                    self::$rules[\'*\'][$name][\'route\']   = \'\';\n"
	"                    self::$rules[\'*\'][$name][\'var\']     = self::parseVar($name);\n"
	"                    self::$rules[\'*\'][$name][\'option\']  = $option;\n"
	"                    self::$rules[\'*\'][$name][\'pattern\'] = $pattern;\n"
	"                }\n"
	"            } else {\n"
	"                $item          = [];\n"
	"                $completeMatch = Config::get(\'route_complete_match\');\n"
	"                foreach ($routes as $key => $val) {\n"
	"                    if (is_numeric($key)) {\n"
	"                        $key = array_shift($val);\n"
	"                    }\n"
	"                    if (is_array($val)) {\n"
	"                        $route    = $val[0];\n"
	"                        $option1  = array_merge($option, isset($val[1]) ? $val[1] : []);\n"
	"                        $pattern1 = array_merge($pattern, isset($val[2]) ? $val[2] : []);\n"
	"                    } else {\n"
	"                        $route = $val;\n"
	"                    }\n"
	"\n"
	"                    $options  = isset($option1) ? $option1 : $option;\n"
	"                    $patterns = isset($pattern1) ? $pattern1 : $pattern;\n"
	"                    if (\'$\' == substr($key, -1, 1)) {\n"
	"                        // 是否完整匹配\n"
	"                        $options[\'complete_match\'] = true;\n"
	"                        $key                       = substr($key, 0, -1);\n"
	"                    } elseif ($completeMatch) {\n"
	"                        $options[\'complete_match\'] = true;\n"
	"                    }\n"
	"                    $key    = trim($key, \'/\');\n"
	"                    $vars   = self::parseVar($key);\n"
	"                    $item[] = [\'rule\' => $key, \'route\' => $route, \'var\' => $vars, \'option\' => $options, \'pattern\' => $patterns];\n"
	"                    // 设置路由标识\n"
	"                    $suffix = isset($options[\'ext\']) ? $options[\'ext\'] : null;\n"
	"                    self::name($route, [$name . ($key ? \'/\' . $key : \'\'), $vars, self::$domain, $suffix]);\n"
	"                }\n"
	"                self::$rules[\'*\'][$name] = [\'rule\' => $item, \'route\' => \'\', \'var\' => [], \'option\' => $option, \'pattern\' => $pattern];\n"
	"            }\n"
	"\n"
	"            foreach ([\'get\', \'post\', \'put\', \'delete\', \'patch\', \'head\', \'options\'] as $method) {\n"
	"                if (!isset(self::$rules[$method][$name])) {\n"
	"                    self::$rules[$method][$name] = true;\n"
	"                } elseif (is_array(self::$rules[$method][$name])) {\n"
	"                    self::$rules[$method][$name] = array_merge(self::$rules[\'*\'][$name], self::$rules[$method][$name]);\n"
	"                }\n"
	"            }\n"
	"\n"
	"        } elseif ($routes instanceof \\Closure) {\n"
	"            // 闭包注册\n"
	"            $currentOption  = self::getGroup(\'option\');\n"
	"            $currentPattern = self::getGroup(\'pattern\');\n"
	"            self::setGroup(\'\', array_merge($currentOption, $option), array_merge($currentPattern, $pattern));\n"
	"            call_user_func_array($routes, []);\n"
	"            self::setGroup($currentGroup, $currentOption, $currentPattern);\n"
	"        } else {\n"
	"            // 批量注册路由\n"
	"            self::rule($routes, \'\', \'*\', $option, $pattern);\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册路由\n"
	"     * @access public\n"
	"     * @param string|array $rule    路由规则\n"
	"     * @param string       $route   路由地址\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function any($rule, $route = \'\', $option = [], $pattern = [])\n"
	"    {\n"
	"        self::rule($rule, $route, \'*\', $option, $pattern);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册GET路由\n"
	"     * @access public\n"
	"     * @param string|array $rule    路由规则\n"
	"     * @param string       $route   路由地址\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function get($rule, $route = \'\', $option = [], $pattern = [])\n"
	"    {\n"
	"        self::rule($rule, $route, \'GET\', $option, $pattern);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册POST路由\n"
	"     * @access public\n"
	"     * @param string|array $rule    路由规则\n"
	"     * @param string       $route   路由地址\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function post($rule, $route = \'\', $option = [], $pattern = [])\n"
	"    {\n"
	"        self::rule($rule, $route, \'POST\', $option, $pattern);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册PUT路由\n"
	"     * @access public\n"
	"     * @param string|array $rule    路由规则\n"
	"     * @param string       $route   路由地址\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function put($rule, $route = \'\', $option = [], $pattern = [])\n"
	"    {\n"
	"        self::rule($rule, $route, \'PUT\', $option, $pattern);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册DELETE路由\n"
	"     * @access public\n"
	"     * @param string|array $rule    路由规则\n"
	"     * @param string       $route   路由地址\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function delete($rule, $route = \'\', $option = [], $pattern = [])\n"
	"    {\n"
	"        self::rule($rule, $route, \'DELETE\', $option, $pattern);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册PATCH路由\n"
	"     * @access public\n"
	"     * @param string|array $rule    路由规则\n"
	"     * @param string       $route   路由地址\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function patch($rule, $route = \'\', $option = [], $pattern = [])\n"
	"    {\n"
	"        self::rule($rule, $route, \'PATCH\', $option, $pattern);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册资源路由\n"
	"     * @access public\n"
	"     * @param string|array $rule    路由规则\n"
	"     * @param string       $route   路由地址\n"
	"     * @param array        $option  路由参数\n"
	"     * @param array        $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function resource($rule, $route = \'\', $option = [], $pattern = [])\n"
	"    {\n"
	"        if (is_array($rule)) {\n"
	"            foreach ($rule as $key => $val) {\n"
	"                if (is_array($val)) {\n"
	"                    list($val, $option, $pattern) = array_pad($val, 3, []);\n"
	"                }\n"
	"                self::resource($key, $val, $option, $pattern);\n"
	"            }\n"
	"        } else {\n"
	"            if (strpos($rule, \'.\')) {\n"
	"                // 注册嵌套资源路由\n"
	"                $array = explode(\'.\', $rule);\n"
	"                $last  = array_pop($array);\n"
	"                $item  = [];\n"
	"                foreach ($array as $val) {\n"
	"                    $item[] = $val . \'/:\' . (isset($option[\'var\'][$val]) ? $option[\'var\'][$val] : $val . \'_id\');\n"
	"                }\n"
	"                $rule = implode(\'/\', $item) . \'/\' . $last;\n"
	"            }\n"
	"            // 注册资源路由\n"
	"            foreach (self::$rest as $key => $val) {\n"
	"                if ((isset($option[\'only\']) && !in_array($key, $option[\'only\']))\n"
	"                    || (isset($option[\'except\']) && in_array($key, $option[\'except\']))) {\n"
	"                    continue;\n"
	"                }\n"
	"                if (isset($last) && strpos($val[1], \':id\') && isset($option[\'var\'][$last])) {\n"
	"                    $val[1] = str_replace(\':id\', \':\' . $option[\'var\'][$last], $val[1]);\n"
	"                } elseif (strpos($val[1], \':id\') && isset($option[\'var\'][$rule])) {\n"
	"                    $val[1] = str_replace(\':id\', \':\' . $option[\'var\'][$rule], $val[1]);\n"
	"                }\n"
	"                $item           = ltrim($rule . $val[1], \'/\');\n"
	"                $option[\'rest\'] = $key;\n"
	"                self::rule($item . \'$\', $route . \'/\' . $val[2], $val[0], $option, $pattern);\n"
	"            }\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册控制器路由 操作方法对应不同的请求后缀\n"
	"     * @access public\n"
	"     * @param string $rule    路由规则\n"
	"     * @param string $route   路由地址\n"
	"     * @param array  $option  路由参数\n"
	"     * @param array  $pattern 变量规则\n"
	"     * @return void\n"
	"     */\n"
	"    public static function controller($rule, $route = \'\', $option = [], $pattern = [])\n"
	"    {\n"
	"        foreach (self::$methodPrefix as $type => $val) {\n"
	"            self::$type($rule . \'/:action\', $route . \'/\' . $val . \':action\', $option, $pattern);\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册别名路由\n"
	"     * @access public\n"
	"     * @param string|array $rule   路由别名\n"
	"     * @param string       $route  路由地址\n"
	"     * @param array        $option 路由参数\n"
	"     * @return void\n"
	"     */\n"
	"    public static function alias($rule = null, $route = \'\', $option = [])\n"
	"    {\n"
	"        if (is_array($rule)) {\n"
	"            self::$rules[\'alias\'] = array_merge(self::$rules[\'alias\'], $rule);\n"
	"        } else {\n"
	"            self::$rules[\'alias\'][$rule] = $option ? [$route, $option] : $route;\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置不同请求类型下面的方法前缀\n"
	"     * @access public\n"
	"     * @param string $method 请求类型\n"
	"     * @param string $prefix 类型前缀\n"
	"     * @return void\n"
	"     */\n"
	"    public static function setMethodPrefix($method, $prefix = \'\')\n"
	"    {\n"
	"        if (is_array($method)) {\n"
	"            self::$methodPrefix = array_merge(self::$methodPrefix, array_change_key_case($method));\n"
	"        } else {\n"
	"            self::$methodPrefix[strtolower($method)] = $prefix;\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * rest方法定义和修改\n"
	"     * @access public\n"
	"     * @param string|array $name     方法名称\n"
	"     * @param array|bool   $resource 资源\n"
	"     * @return void\n"
	"     */\n"
	"    public static function rest($name, $resource = [])\n"
	"    {\n"
	"        if (is_array($name)) {\n"
	"            self::$rest = $resource ? $name : array_merge(self::$rest, $name);\n"
	"        } else {\n"
	"            self::$rest[$name] = $resource;\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册未匹配路由规则后的处理\n"
	"     * @access public\n"
	"     * @param string $route  路由地址\n"
	"     * @param string $method 请求类型\n"
	"     * @param array  $option 路由参数\n"
	"     * @return void\n"
	"     */\n"
	"    public static function miss($route, $method = \'*\', $option = [])\n"
	"    {\n"
	"        self::rule(\'__miss__\', $route, $method, $option, []);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 注册一个自动解析的URL路由\n"
	"     * @access public\n"
	"     * @param string $route 路由地址\n"
	"     * @return void\n"
	"     */\n"
	"    public static function auto($route)\n"
	"    {\n"
	"        self::rule(\'__auto__\', $route, \'*\', [], []);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取或者批量设置路由定义\n"
	"     * @access public\n"
	"     * @param mixed $rules 请求类型或者路由定义数组\n"
	"     * @return array\n"
	"     */\n"
	"    public static function rules($rules = \'\')\n"
	"    {\n"
	"        if (is_array($rules)) {\n"
	"            self::$rules = $rules;\n"
	"        } elseif ($rules) {\n"
	"            return true === $rules ? self::$rules : self::$rules[strtolower($rules)];\n"
	"        } else {\n"
	"            $rules = self::$rules;\n"
	"            unset($rules[\'pattern\'], $rules[\'alias\'], $rules[\'domain\'], $rules[\'name\']);\n"
	"            return $rules;\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 检测子域名部署\n"
	"     * @access public\n"
	"     * @param Request $request      Request请求对象\n"
	"     * @param array   $currentRules 当前路由规则\n"
	"     * @param string  $method       请求类型\n"
	"     * @return void\n"
	"     */\n"
	"    public static function checkDomain($request, &$currentRules, $method = \'get\')\n"
	"    {\n"
	"        // 域名规则\n"
	"        $rules = self::$rules[\'domain\'];\n"
	"        // 开启子域名部署 支持二级和三级域名\n"
	"        if (!empty($rules)) {\n"
	"            $host = $request->host(true);\n"
	"            if (isset($rules[$host])) {\n"
	"                // 完整域名或者IP配置\n"
	"                $item = $rules[$host];\n"
	"            } else {\n"
	"                $rootDomain = Config::get(\'url_domain_root\');\n"
	"                if ($rootDomain) {\n"
	"                    // 配置域名根 例如 thinkphp.cn 163.com.cn 如果是国家级域名 com.cn net.cn 之类的域名需要配置\n"
	"                    $domain = explode(\'.\', rtrim(stristr($host, $rootDomain, true), \'.\'));\n"
	"                } else {\n"
	"                    $domain = explode(\'.\', $host, -2);\n"
	"                }\n"
	"                // 子域名配置\n"
	"                if (!empty($domain)) {\n"
	"                    // 当前子域名\n"
	"                    $subDomain       = implode(\'.\', $domain);\n"
	"                    self::$subDomain = $subDomain;\n"
	"                    $domain2         = array_pop($domain);\n"
	"                    if ($domain) {\n"
	"                        // 存在三级域名\n"
	"                        $domain3 = array_pop($domain);\n"
	"                    }\n"
	"                    if ($subDomain && isset($rules[$subDomain])) {\n"
	"                        // 子域名配置\n"
	"                        $item = $rules[$subDomain];\n"
	"                    } elseif (isset($rules[\'*.\' . $domain2]) && !empty($domain3)) {\n"
	"                        // 泛三级域名\n"
	"                        $item      = $rules[\'*.\' . $domain2];\n"
	"                        $panDomain = $domain3;\n"
	"                    } elseif (isset($rules[\'*\']) && !empty($domain2)) {\n"
	"                        // 泛二级域名\n"
	"                        if (\'www\' != $domain2) {\n"
	"                            $item      = $rules[\'*\'];\n"
	"                            $panDomain = $domain2;\n"
	"                        }\n"
	"                    }\n"
	"                }\n"
	"            }\n"
	"            if (!empty($item)) {\n"
	"                if (isset($panDomain)) {\n"
	"                    // 保存当前泛域名\n"
	"                    $request->route([\'__domain__\' => $panDomain]);\n"
	"                }\n"
	"                if (isset($item[\'[bind]\'])) {\n"
	"                    // 解析子域名部署规则\n"
	"                    list($rule, $option, $pattern) = $item[\'[bind]\'];\n"
	"                    if (!empty($option[\'https\']) && !$request->isSsl()) {\n"
	"                        // https检测\n"
	"                        throw new HttpException(404, \'must use https request:\' . $host);\n"
	"                    }\n"
	"\n"
	"                    if (strpos($rule, \'?\')) {\n"
	"                        // 传入其它参数\n"
	"                        $array  = parse_url($rule);\n"
	"                        $result = $array[\'path\'];\n"
	"                        parse_str($array[\'query\'], $params);\n"
	"                        if (isset($panDomain)) {\n"
	"                            $pos = array_search(\'*\', $params);\n"
	"                            if (false !== $pos) {\n"
	"                                // 泛域名作为参数\n"
	"                                $params[$pos] = $panDomain;\n"
	"                            }\n"
	"                        }\n"
	"                        $_GET = array_merge($_GET, $params);\n"
	"                    } else {\n"
	"                        $result = $rule;\n"
	"                    }\n"
	"\n"
	"                    if (0 === strpos($result, \'\\\\\')) {\n"
	"                        // 绑定到命名空间 例如 \\app\\index\\behavior\n"
	"                        self::$bind = [\'type\' => \'namespace\', \'namespace\' => $result];\n"
	"                    } elseif (0 === strpos($result, \'@\')) {\n"
	"                        // 绑定到类 例如 @app\\index\\controller\\User\n"
	"                        self::$bind = [\'type\' => \'class\', \'class\' => substr($result, 1)];\n"
	"                    } else {\n"
	"                        // 绑定到模块/控制器 例如 index/user\n"
	"                        self::$bind = [\'type\' => \'module\', \'module\' => $result];\n"
	"                    }\n"
	"                    self::$domainBind = true;\n"
	"                } else {\n"
	"                    self::$domainRule = $item;\n"
	"                    $currentRules     = isset($item[$method]) ? $item[$method] : $item[\'*\'];\n"
	"                }\n"
	"            }\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 检测URL路由\n"
	"     * @access public\n"
	"     * @param Request $request     Request请求对象\n"
	"     * @param string  $url         URL地址\n"
	"     * @param string  $depr        URL分隔符\n"
	"     * @param bool    $checkDomain 是否检测域名规则\n"
	"     * @return false|array\n"
	"     */\n"
	"    public static function check($request, $url, $depr = \'/\', $checkDomain = false)\n"
	"    {\n"
	"        //检查解析缓存\n"
	"        if (!App::$debug && Config::get(\'route_check_cache\')) {\n"
	"            $key = self::getCheckCacheKey($request);\n"
	"            if (Cache::has($key)) {\n"
	"                list($rule, $route, $pathinfo, $option, $matches) = Cache::get($key);\n"
	"                return self::parseRule($rule, $route, $pathinfo, $option, $matches, true);\n"
	"            }\n"
	"        }\n"
	"\n"
	"        // 分隔符替换 确保路由定义使用统一的分隔符\n"
	"        $url = str_replace($depr, \'|\', $url);\n"
	"\n"
	"        if (isset(self::$rules[\'alias\'][$url]) || isset(self::$rules[\'alias\'][strstr($url, \'|\', true)])) {\n"
	"            // 检测路由别名\n"
	"            $result = self::checkRouteAlias($request, $url, $depr);\n"
	"            if (false !== $result) {\n"
	"                return $result;\n"
	"            }\n"
	"        }\n"
	"        $method = strtolower($request->method());\n"
	"        // 获取当前请求类型的路由规则\n"
	"        $rules = isset(self::$rules[$method]) ? self::$rules[$method] : [];\n"
	"        // 检测域名部署\n"
	"        if ($checkDomain) {\n"
	"            self::checkDomain($request, $rules, $method);\n"
	"        }\n"
	"        // 检测URL绑定\n"
	"        $return = self::checkUrlBind($url, $rules, $depr);\n"
	"        if (false !== $return) {\n"
	"            return $return;\n"
	"        }\n"
	"        if (\'|\' != $url) {\n"
	"            $url = rtrim($url, \'|\');\n"
	"        }\n"
	"        $item = str_replace(\'|\', \'/\', $url);\n"
	"        if (isset($rules[$item])) {\n"
	"            // 静态路由规则检测\n"
	"            $rule = $rules[$item];\n"
	"            if (true === $rule) {\n"
	"                $rule = self::getRouteExpress($item);\n"
	"            }\n"
	"            if (!empty($rule[\'route\']) && self::checkOption($rule[\'option\'], $request)) {\n"
	"                self::setOption($rule[\'option\']);\n"
	"                return self::parseRule($item, $rule[\'route\'], $url, $rule[\'option\']);\n"
	"            }\n"
	"        }\n"
	"\n"
	"        // 路由规则检测\n"
	"        if (!empty($rules)) {\n"
	"            return self::checkRoute($request, $rules, $url, $depr);\n"
	"        }\n"
	"        return false;\n"
	"    }\n"
	"\n"
	"    private static function getRouteExpress($key)\n"
	"    {\n"
	"        return self::$domainRule ? self::$domainRule[\'*\'][$key] : self::$rules[\'*\'][$key];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 检测路由规则\n"
	"     * @access private\n"
	"     * @param Request $request\n"
	"     * @param array   $rules   路由规则\n"
	"     * @param string  $url     URL地址\n"
	"     * @param string  $depr    URL分割符\n"
	"     * @param string  $group   路由分组名\n"
	"     * @param array   $options 路由参数（分组）\n"
	"     * @return mixed\n"
	"     */\n"
	"    private static function checkRoute($request, $rules, $url, $depr = \'/\', $group = \'\', $options = [])\n"
	"    {\n"
	"        foreach ($rules as $key => $item) {\n"
	"            if (true === $item) {\n"
	"                $item = self::getRouteExpress($key);\n"
	"            }\n"
	"            if (!isset($item[\'rule\'])) {\n"
	"                continue;\n"
	"            }\n"
	"            $rule    = $item[\'rule\'];\n"
	"            $route   = $item[\'route\'];\n"
	"            $vars    = $item[\'var\'];\n"
	"            $option  = $item[\'option\'];\n"
	"            $pattern = $item[\'pattern\'];\n"
	"\n"
	"            // 检查参数有效性\n"
	"            if (!self::checkOption($option, $request)) {\n"
	"                continue;\n"
	"            }\n"
	"\n"
	"            if (isset($option[\'ext\'])) {\n"
	"                // 路由ext参数 优先于系统配置的URL伪静态后缀参数\n"
	"                $url = preg_replace(\'/\\.\' . $request->ext() . \'$/i\', \'\', $url);\n"
	"            }\n"
	"\n"
	"            if (is_array($rule)) {\n"
	"                // 分组路由\n"
	"                $pos = strpos(str_replace(\'<\', \':\', $key), \':\');\n"
	"                if (false !== $pos) {\n"
	"                    $str = substr($key, 0, $pos);\n"
	"                } else {\n"
	"                    $str = $key;\n"
	"                }\n"
	"                if (is_string($str) && $str && 0 !== stripos(str_replace(\'|\', \'/\', $url), $str)) {\n"
	"                    continue;\n"
	"                }\n"
	"                self::setOption($option);\n"
	"                $result = self::checkRoute($request, $rule, $url, $depr, $key, $option);\n"
	"                if (false !== $result) {\n"
	"                    return $result;\n"
	"                }\n"
	"            } elseif ($route) {\n"
	"                if (\'__miss__\' == $rule || \'__auto__\' == $rule) {\n"
	"                    // 指定特殊路由\n"
	"                    $var    = trim($rule, \'__\');\n"
	"                    ${$var} = $item;\n"
	"                    continue;\n"
	"                }\n"
	"                if ($group) {\n"
	"                    $rule = $group . ($rule ? \'/\' . ltrim($rule, \'/\') : \'\');\n"
	"                }\n"
	"\n"
	"                self::setOption($option);\n"
	"                if (isset($options[\'bind_model\']) && isset($option[\'bind_model\'])) {\n"
	"                    $option[\'bind_model\'] = array_merge($options[\'bind_model\'], $option[\'bind_model\']);\n"
	"                }\n"
	"                $result = self::checkRule($rule, $route, $url, $pattern, $option, $depr);\n"
	"                if (false !== $result) {\n"
	"                    return $result;\n"
	"                }\n"
	"            }\n"
	"        }\n"
	"        if (isset($auto)) {\n"
	"            // 自动解析URL地址\n"
	"            return self::parseUrl($auto[\'route\'] . \'/\' . $url, $depr);\n"
	"        } elseif (isset($miss)) {\n"
	"            // 未匹配所有路由的路由规则处理\n"
	"            return self::parseRule(\'\', $miss[\'route\'], $url, $miss[\'option\']);\n"
	"        }\n"
	"        return false;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 检测路由别名\n"
	"     * @access private\n"
	"     * @param Request $request\n"
	"     * @param string  $url  URL地址\n"
	"     * @param string  $depr URL分隔符\n"
	"     * @return mixed\n"
	"     */\n"
	"    private static function checkRouteAlias($request, $url, $depr)\n"
	"    {\n"
	"        $array = explode(\'|\', $url);\n"
	"        $alias = array_shift($array);\n"
	"        $item  = self::$rules[\'alias\'][$alias];\n"
	"\n"
	"        if (is_array($item)) {\n"
	"            list($rule, $option) = $item;\n"
	"            $action              = $array[0];\n"
	"            if (isset($option[\'allow\']) && !in_array($action, explode(\',\', $option[\'allow\']))) {\n"
	"                // 允许操作\n"
	"                return false;\n"
	"            } elseif (isset($option[\'except\']) && in_array($action, explode(\',\', $option[\'except\']))) {\n"
	"                // 排除操作\n"
	"                return false;\n"
	"            }\n"
	"            if (isset($option[\'method\'][$action])) {\n"
	"                $option[\'method\'] = $option[\'method\'][$action];\n"
	"            }\n"
	"        } else {\n"
	"            $rule = $item;\n"
	"        }\n"
	"        $bind = implode(\'|\', $array);\n"
	"        // 参数有效性检查\n"
	"        if (isset($option) && !self::checkOption($option, $request)) {\n"
	"            // 路由不匹配\n"
	"            return false;\n"
	"        } elseif (0 === strpos($rule, \'\\\\\')) {\n"
	"            // 路由到类\n"
	"            return self::bindToClass($bind, substr($rule, 1), $depr);\n"
	"        } elseif (0 === strpos($rule, \'@\')) {\n"
	"            // 路由到控制器类\n"
	"            return self::bindToController($bind, substr($rule, 1), $depr);\n"
	"        } else {\n"
	"            // 路由到模块/控制器\n"
	"            return self::bindToModule($bind, $rule, $depr);\n"
	"        }\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 检测URL绑定\n"
	"     * @access private\n"
	"     * @param string $url   URL地址\n"
	"     * @param array  $rules 路由规则\n"
	"     * @param string $depr  URL分隔符\n"
	"     * @return mixed\n"
	"     */\n"
	"    private static function checkUrlBind(&$url, &$rules, $depr = \'/\')\n"
	"    {\n"
	"        if (!empty(self::$bind)) {\n"
	"            $type = self::$bind[\'type\'];\n"
	"            $bind = self::$bind[$type];\n"
	"            // 记录绑定信息\n"
	"            App::$debug && Log::record(\'[ BIND ] \' . var_export($bind, true), \'info\');\n"
	"            // 如果有URL绑定 则进行绑定检测\n"
	"            switch ($type) {\n"
	"                case \'class\':\n"
	"                    // 绑定到类\n"
	"                    return self::bindToClass($url, $bind, $depr);\n"
	"                case \'controller\':\n"
	"                    // 绑定到控制器类\n"
	"                    return self::bindToController($url, $bind, $depr);\n"
	"                case \'namespace\':\n"
	"                    // 绑定到命名空间\n"
	"                    return self::bindToNamespace($url, $bind, $depr);\n"
	"            }\n"
	"        }\n"
	"        return false;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 绑定到类\n"
	"     * @access public\n"
	"     * @param string $url   URL地址\n"
	"     * @param string $class 类名（带命名空间）\n"
	"     * @param string $depr  URL分隔符\n"
	"     * @return array\n"
	"     */\n"
	"    public static function bindToClass($url, $class, $depr = \'/\')\n"
	"    {\n"
	"        $url    = str_replace($depr, \'|\', $url);\n"
	"        $array  = explode(\'|\', $url, 2);\n"
	"        $action = !empty($array[0]) ? $array[0] : Config::get(\'default_action\');\n"
	"        if (!empty($array[1])) {\n"
	"            self::parseUrlParams($array[1]);\n"
	"        }\n"
	"        return [\'type\' => \'method\', \'method\' => [$class, $action], \'var\' => []];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 绑定到命名空间\n"
	"     * @access public\n"
	"     * @param string $url       URL地址\n"
	"     * @param string $namespace 命名空间\n"
	"     * @param string $depr      URL分隔符\n"
	"     * @return array\n"
	"     */\n"
	"    public static function bindToNamespace($url, $namespace, $depr = \'/\')\n"
	"    {\n"
	"        $url    = str_replace($depr, \'|\', $url);\n"
	"        $array  = explode(\'|\', $url, 3);\n"
	"        $class  = !empty($array[0]) ? $array[0] : Config::get(\'default_controller\');\n"
	"        $method = !empty($array[1]) ? $array[1] : Config::get(\'default_action\');\n"
	"        if (!empty($array[2])) {\n"
	"            self::parseUrlParams($array[2]);\n"
	"        }\n"
	"        return [\'type\' => \'method\', \'method\' => [$namespace . \'\\\\\' . Loader::parseName($class, 1), $method], \'var\' => []];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 绑定到控制器类\n"
	"     * @access public\n"
	"     * @param string $url        URL地址\n"
	"     * @param string $controller 控制器名 （支持带模块名 index/user ）\n"
	"     * @param string $depr       URL分隔符\n"
	"     * @return array\n"
	"     */\n"
	"    public static function bindToController($url, $controller, $depr = \'/\')\n"
	"    {\n"
	"        $url    = str_replace($depr, \'|\', $url);\n"
	"        $array  = explode(\'|\', $url, 2);\n"
	"        $action = !empty($array[0]) ? $array[0] : Config::get(\'default_action\');\n"
	"        if (!empty($array[1])) {\n"
	"            self::parseUrlParams($array[1]);\n"
	"        }\n"
	"        return [\'type\' => \'controller\', \'controller\' => $controller . \'/\' . $action, \'var\' => []];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 绑定到模块/控制器\n"
	"     * @access public\n"
	"     * @param string $url        URL地址\n"
	"     * @param string $controller 控制器类名（带命名空间）\n"
	"     * @param string $depr       URL分隔符\n"
	"     * @return array\n"
	"     */\n"
	"    public static function bindToModule($url, $controller, $depr = \'/\')\n"
	"    {\n"
	"        $url    = str_replace($depr, \'|\', $url);\n"
	"        $array  = explode(\'|\', $url, 2);\n"
	"        $action = !empty($array[0]) ? $array[0] : Config::get(\'default_action\');\n"
	"        if (!empty($array[1])) {\n"
	"            self::parseUrlParams($array[1]);\n"
	"        }\n"
	"        return [\'type\' => \'module\', \'module\' => $controller . \'/\' . $action];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 路由参数有效性检查\n"
	"     * @access private\n"
	"     * @param array   $option  路由参数\n"
	"     * @param Request $request Request对象\n"
	"     * @return bool\n"
	"     */\n"
	"    private static function checkOption($option, $request)\n"
	"    {\n"
	"        if ((isset($option[\'method\']) && is_string($option[\'method\']) && false === stripos($option[\'method\'], $request->method()))\n"
	"            || (isset($option[\'ajax\']) && $option[\'ajax\'] && !$request->isAjax()) // Ajax检测\n"
	"             || (isset($option[\'ajax\']) && !$option[\'ajax\'] && $request->isAjax()) // 非Ajax检测\n"
	"             || (isset($option[\'pjax\']) && $option[\'pjax\'] && !$request->isPjax()) // Pjax检测\n"
	"             || (isset($option[\'pjax\']) && !$option[\'pjax\'] && $request->isPjax()) // 非Pjax检测\n"
	"             || (isset($option[\'ext\']) && false === stripos(\'|\' . $option[\'ext\'] . \'|\', \'|\' . $request->ext() . \'|\')) // 伪静态后缀检测\n"
	"             || (isset($option[\'deny_ext\']) && false !== stripos(\'|\' . $option[\'deny_ext\'] . \'|\', \'|\' . $request->ext() . \'|\'))\n"
	"            || (isset($option[\'domain\']) && !in_array($option[\'domain\'], [$_SERVER[\'HTTP_HOST\'], self::$subDomain])) // 域名检测\n"
	"             || (isset($option[\'https\']) && $option[\'https\'] && !$request->isSsl()) // https检测\n"
	"             || (isset($option[\'https\']) && !$option[\'https\'] && $request->isSsl()) // https检测\n"
	"             || (!empty($option[\'before_behavior\']) && false === Hook::exec($option[\'before_behavior\'])) // 行为检测\n"
	"             || (!empty($option[\'callback\']) && is_callable($option[\'callback\']) && false === call_user_func($option[\'callback\'])) // 自定义检测\n"
	"        ) {\n"
	"            return false;\n"
	"        }\n"
	"        return true;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 检测路由规则\n"
	"     * @access private\n"
	"     * @param string $rule    路由规则\n"
	"     * @param string $route   路由地址\n"
	"     * @param string $url     URL地址\n"
	"     * @param array  $pattern 变量规则\n"
	"     * @param array  $option  路由参数\n"
	"     * @param string $depr    URL分隔符（全局）\n"
	"     * @return array|false\n"
	"     */\n"
	"    private static function checkRule($rule, $route, $url, $pattern, $option, $depr)\n"
	"    {\n"
	"        // 检查完整规则定义\n"
	"        if (isset($pattern[\'__url__\']) && !preg_match(0 === strpos($pattern[\'__url__\'], \'/\') ? $pattern[\'__url__\'] : \'/^\' . $pattern[\'__url__\'] . \'/\', str_replace(\'|\', $depr, $url))) {\n"
	"            return false;\n"
	"        }\n"
	"        // 检查路由的参数分隔符\n"
	"        if (isset($option[\'param_depr\'])) {\n"
	"            $url = str_replace([\'|\', $option[\'param_depr\']], [$depr, \'|\'], $url);\n"
	"        }\n"
	"\n"
	"        $len1 = substr_count($url, \'|\');\n"
	"        $len2 = substr_count($rule, \'/\');\n"
	"        // 多余参数是否合并\n"
	"        $merge = !empty($option[\'merge_extra_vars\']);\n"
	"        if ($merge && $len1 > $len2) {\n"
	"            $url = str_replace(\'|\', $depr, $url);\n"
	"            $url = implode(\'|\', explode($depr, $url, $len2 + 1));\n"
	"        }\n"
	"\n"
	"        if ($len1 >= $len2 || strpos($rule, \'[\')) {\n"
	"            if (!empty($option[\'complete_match\'])) {\n"
	"                // 完整匹配\n"
	"                if (!$merge && $len1 != $len2 && (false === strpos($rule, \'[\') || $len1 > $len2 || $len1 < $len2 - substr_count($rule, \'[\'))) {\n"
	"                    return false;\n"
	"                }\n"
	"            }\n"
	"            $pattern = array_merge(self::$rules[\'pattern\'], $pattern);\n"
	"            if (false !== $match = self::match($url, $rule, $pattern)) {\n"
	"                // 匹配到路由规则\n"
	"                return self::parseRule($rule, $route, $url, $option, $match);\n"
	"            }\n"
	"        }\n"
	"        return false;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 解析模块的URL地址 [模块/控制器/操作?]参数1=值1&参数2=值2...\n"
	"     * @access public\n"
	"     * @param string $url        URL地址\n"
	"     * @param string $depr       URL分隔符\n"
	"     * @param bool   $autoSearch 是否自动深度搜索控制器\n"
	"     * @return array\n"
	"     */\n"
	"    public static function parseUrl($url, $depr = \'/\', $autoSearch = false)\n"
	"    {\n"
	"\n"
	"        if (isset(self::$bind[\'module\'])) {\n"
	"            $bind = str_replace(\'/\', $depr, self::$bind[\'module\']);\n"
	"            // 如果有模块/控制器绑定\n"
	"            $url = $bind . (\'.\' != substr($bind, -1) ? $depr : \'\') . ltrim($url, $depr);\n"
	"        }\n"
	"        $url              = str_replace($depr, \'|\', $url);\n"
	"        list($path, $var) = self::parseUrlPath($url);\n"
	"        $route            = [null, null, null];\n"
	"        if (isset($path)) {\n"
	"            // 解析模块\n"
	"            $module = Config::get(\'app_multi_module\') ? array_shift($path) : null;\n"
	"            if ($autoSearch) {\n"
	"                // 自动搜索控制器\n"
	"                $dir    = APP_PATH . ($module ? $module . DS : \'\') . Config::get(\'url_controller_layer\');\n"
	"                $suffix = App::$suffix || Config::get(\'controller_suffix\') ? ucfirst(Config::get(\'url_controller_layer\')) : \'\';\n"
	"                $item   = [];\n"
	"                $find   = false;\n"
	"                foreach ($path as $val) {\n"
	"                    $item[] = $val;\n"
	"                    $file   = $dir . DS . str_replace(\'.\', DS, $val) . $suffix . EXT;\n"
	"                    $file   = pathinfo($file, PATHINFO_DIRNAME) . DS . Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1) . EXT;\n"
	"                    if (is_file($file)) {\n"
	"                        $find = true;\n"
	"                        break;\n"
	"                    } else {\n"
	"                        $dir .= DS . Loader::parseName($val);\n"
	"                    }\n"
	"                }\n"
	"                if ($find) {\n"
	"                    $controller = implode(\'.\', $item);\n"
	"                    $path       = array_slice($path, count($item));\n"
	"                } else {\n"
	"                    $controller = array_shift($path);\n"
	"                }\n"
	"            } else {\n"
	"                // 解析控制器\n"
	"                $controller = !empty($path) ? array_shift($path) : null;\n"
	"            }\n"
	"            // 解析操作\n"
	"            $action = !empty($path) ? array_shift($path) : null;\n"
	"            // 解析额外参数\n"
	"            self::parseUrlParams(empty($path) ? \'\' : implode(\'|\', $path));\n"
	"            // 封装路由\n"
	"            $route = [$module, $controller, $action];\n"
	"            // 检查地址是否被定义过路由\n"
	"            $name  = strtolower($module . \'/\' . Loader::parseName($controller, 1) . \'/\' . $action);\n"
	"            $name2 = \'\';\n"
	"            if (empty($module) || isset($bind) && $module == $bind) {\n"
	"                $name2 = strtolower(Loader::parseName($controller, 1) . \'/\' . $action);\n"
	"            }\n"
	"\n"
	"            if (isset(self::$rules[\'name\'][$name]) || isset(self::$rules[\'name\'][$name2])) {\n"
	"                throw new HttpException(404, \'invalid request:\' . str_replace(\'|\', $depr, $url));\n"
	"            }\n"
	"        }\n"
	"        return [\'type\' => \'module\', \'module\' => $route];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 解析URL的pathinfo参数和变量\n"
	"     * @access private\n"
	"     * @param string $url URL地址\n"
	"     * @return array\n"
	"     */\n"
	"    private static function parseUrlPath($url)\n"
	"    {\n"
	"        // 分隔符替换 确保路由定义使用统一的分隔符\n"
	"        $url = str_replace(\'|\', \'/\', $url);\n"
	"        $url = trim($url, \'/\');\n"
	"        $var = [];\n"
	"        if (false !== strpos($url, \'?\')) {\n"
	"            // [模块/控制器/操作?]参数1=值1&参数2=值2...\n"
	"            $info = parse_url($url);\n"
	"            $path = explode(\'/\', $info[\'path\']);\n"
	"            parse_str($info[\'query\'], $var);\n"
	"        } elseif (strpos($url, \'/\')) {\n"
	"            // [模块/控制器/操作]\n"
	"            $path = explode(\'/\', $url);\n"
	"        } else {\n"
	"            $path = [$url];\n"
	"        }\n"
	"        return [$path, $var];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 检测URL和规则路由是否匹配\n"
	"     * @access private\n"
	"     * @param string $url     URL地址\n"
	"     * @param string $rule    路由规则\n"
	"     * @param array  $pattern 变量规则\n"
	"     * @return array|false\n"
	"     */\n"
	"    private static function match($url, $rule, $pattern)\n"
	"    {\n"
	"        $m2 = explode(\'/\', $rule);\n"
	"        $m1 = explode(\'|\', $url);\n"
	"\n"
	"        $var = [];\n"
	"        foreach ($m2 as $key => $val) {\n"
	"            // val中定义了多个变量 <id><name>\n"
	"            if (false !== strpos($val, \'<\') && preg_match_all(\'/<(\\w+(\\??))>/\', $val, $matches)) {\n"
	"                $value   = [];\n"
	"                $replace = [];\n"
	"                foreach ($matches[1] as $name) {\n"
	"                    if (strpos($name, \'?\')) {\n"
	"                        $name      = substr($name, 0, -1);\n"
	"                        $replace[] = \'(\' . (isset($pattern[$name]) ? $pattern[$name] : \'\\w+\') . \')?\';\n"
	"                    } else {\n"
	"                        $replace[] = \'(\' . (isset($pattern[$name]) ? $pattern[$name] : \'\\w+\') . \')\';\n"
	"                    }\n"
	"                    $value[] = $name;\n"
	"                }\n"
	"                $val = str_replace($matches[0], $replace, $val);\n"
	"                if (preg_match(\'/^\' . $val . \'$/\', isset($m1[$key]) ? $m1[$key] : \'\', $match)) {\n"
	"                    array_shift($match);\n"
	"                    foreach ($value as $k => $name) {\n"
	"                        if (isset($match[$k])) {\n"
	"                            $var[$name] = $match[$k];\n"
	"                        }\n"
	"                    }\n"
	"                    continue;\n"
	"                } else {\n"
	"                    return false;\n"
	"                }\n"
	"            }\n"
	"\n"
	"            if (0 === strpos($val, \'[:\')) {\n"
	"                // 可选参数\n"
	"                $val      = substr($val, 1, -1);\n"
	"                $optional = true;\n"
	"            } else {\n"
	"                $optional = false;\n"
	"            }\n"
	"            if (0 === strpos($val, \':\')) {\n"
	"                // URL变量\n"
	"                $name = substr($val, 1);\n"
	"                if (!$optional && !isset($m1[$key])) {\n"
	"                    return false;\n"
	"                }\n"
	"                if (isset($m1[$key]) && isset($pattern[$name])) {\n"
	"                    // 检查变量规则\n"
	"                    if ($pattern[$name] instanceof \\Closure) {\n"
	"                        $result = call_user_func_array($pattern[$name], [$m1[$key]]);\n"
	"                        if (false === $result) {\n"
	"                            return false;\n"
	"                        }\n"
	"                    } elseif (!preg_match(0 === strpos($pattern[$name], \'/\') ? $pattern[$name] : \'/^\' . $pattern[$name] . \'$/\', $m1[$key])) {\n"
	"                        return false;\n"
	"                    }\n"
	"                }\n"
	"                $var[$name] = isset($m1[$key]) ? $m1[$key] : \'\';\n"
	"            } elseif (!isset($m1[$key]) || 0 !== strcasecmp($val, $m1[$key])) {\n"
	"                return false;\n"
	"            }\n"
	"        }\n"
	"        // 成功匹配后返回URL中的动态变量数组\n"
	"        return $var;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 解析规则路由\n"
	"     * @access private\n"
	"     * @param string $rule      路由规则\n"
	"     * @param string $route     路由地址\n"
	"     * @param string $pathinfo  URL地址\n"
	"     * @param array  $option    路由参数\n"
	"     * @param array  $matches   匹配的变量\n"
	"     * @param bool   $fromCache 通过缓存解析\n"
	"     * @return array\n"
	"     */\n"
	"    private static function parseRule($rule, $route, $pathinfo, $option = [], $matches = [], $fromCache = false)\n"
	"    {\n"
	"        $request = Request::instance();\n"
	"\n"
	"        //保存解析缓存\n"
	"        if (Config::get(\'route_check_cache\') && !$fromCache) {\n"
	"            try {\n"
	"                $key = self::getCheckCacheKey($request);\n"
	"                Cache::tag(\'route_check\')->set($key, [$rule, $route, $pathinfo, $option, $matches]);\n"
	"            } catch (\\Exception $e) {\n"
	"\n"
	"            }\n"
	"        }\n"
	"\n"
	"        // 解析路由规则\n"
	"        if ($rule) {\n"
	"            $rule = explode(\'/\', $rule);\n"
	"            // 获取URL地址中的参数\n"
	"            $paths = explode(\'|\', $pathinfo);\n"
	"            foreach ($rule as $item) {\n"
	"                $fun = \'\';\n"
	"                if (0 === strpos($item, \'[:\')) {\n"
	"                    $item = substr($item, 1, -1);\n"
	"                }\n"
	"                if (0 === strpos($item, \':\')) {\n"
	"                    $var           = substr($item, 1);\n"
	"                    $matches[$var] = array_shift($paths);\n"
	"                } else {\n"
	"                    // 过滤URL中的静态变量\n"
	"                    array_shift($paths);\n"
	"                }\n"
	"            }\n"
	"        } else {\n"
	"            $paths = explode(\'|\', $pathinfo);\n"
	"        }\n"
	"\n"
	"        // 获取路由地址规则\n"
	"        if (is_string($route) && isset($option[\'prefix\'])) {\n"
	"            // 路由地址前缀\n"
	"            $route = $option[\'prefix\'] . $route;\n"
	"        }\n"
	"        // 替换路由地址中的变量\n"
	"        if (is_string($route) && !empty($matches)) {\n"
	"            foreach ($matches as $key => $val) {\n"
	"                if (false !== strpos($route, \':\' . $key)) {\n"
	"                    $route = str_replace(\':\' . $key, $val, $route);\n"
	"                }\n"
	"            }\n"
	"        }\n"
	"\n"
	"        // 绑定模型数据\n"
	"        if (isset($option[\'bind_model\'])) {\n"
	"            $bind = [];\n"
	"            foreach ($option[\'bind_model\'] as $key => $val) {\n"
	"                if ($val instanceof \\Closure) {\n"
	"                    $result = call_user_func_array($val, [$matches]);\n"
	"                } else {\n"
	"                    if (is_array($val)) {\n"
	"                        $fields    = explode(\'&\', $val[1]);\n"
	"                        $model     = $val[0];\n"
	"                        $exception = isset($val[2]) ? $val[2] : true;\n"
	"                    } else {\n"
	"                        $fields    = [\'id\'];\n"
	"                        $model     = $val;\n"
	"                        $exception = true;\n"
	"                    }\n"
	"                    $where = [];\n"
	"                    $match = true;\n"
	"                    foreach ($fields as $field) {\n"
	"                        if (!isset($matches[$field])) {\n"
	"                            $match = false;\n"
	"                            break;\n"
	"                        } else {\n"
	"                            $where[$field] = $matches[$field];\n"
	"                        }\n"
	"                    }\n"
	"                    if ($match) {\n"
	"                        $query  = strpos($model, \'\\\\\') ? $model::where($where) : Loader::model($model)->where($where);\n"
	"                        $result = $query->failException($exception)->find();\n"
	"                    }\n"
	"                }\n"
	"                if (!empty($result)) {\n"
	"                    $bind[$key] = $result;\n"
	"                }\n"
	"            }\n"
	"            $request->bind($bind);\n"
	"        }\n"
	"\n"
	"        if (!empty($option[\'response\'])) {\n"
	"            Hook::add(\'response_send\', $option[\'response\']);\n"
	"        }\n"
	"\n"
	"        // 解析额外参数\n"
	"        self::parseUrlParams(empty($paths) ? \'\' : implode(\'|\', $paths), $matches);\n"
	"        // 记录匹配的路由信息\n"
	"        $request->routeInfo([\'rule\' => $rule, \'route\' => $route, \'option\' => $option, \'var\' => $matches]);\n"
	"\n"
	"        // 检测路由after行为\n"
	"        if (!empty($option[\'after_behavior\'])) {\n"
	"            if ($option[\'after_behavior\'] instanceof \\Closure) {\n"
	"                $result = call_user_func_array($option[\'after_behavior\'], []);\n"
	"            } else {\n"
	"                foreach ((array) $option[\'after_behavior\'] as $behavior) {\n"
	"                    $result = Hook::exec($behavior, \'\');\n"
	"                    if (!is_null($result)) {\n"
	"                        break;\n"
	"                    }\n"
	"                }\n"
	"            }\n"
	"            // 路由规则重定向\n"
	"            if ($result instanceof Response) {\n"
	"                return [\'type\' => \'response\', \'response\' => $result];\n"
	"            } elseif (is_array($result)) {\n"
	"                return $result;\n"
	"            }\n"
	"        }\n"
	"\n"
	"        if ($route instanceof \\Closure) {\n"
	"            // 执行闭包\n"
	"            $result = [\'type\' => \'function\', \'function\' => $route];\n"
	"        } elseif (0 === strpos($route, \'/\') || strpos($route, \'://\')) {\n"
	"            // 路由到重定向地址\n"
	"            $result = [\'type\' => \'redirect\', \'url\' => $route, \'status\' => isset($option[\'status\']) ? $option[\'status\'] : 301];\n"
	"        } elseif (false !== strpos($route, \'\\\\\')) {\n"
	"            // 路由到方法\n"
	"            list($path, $var) = self::parseUrlPath($route);\n"
	"            $route            = str_replace(\'/\', \'@\', implode(\'/\', $path));\n"
	"            $method           = strpos($route, \'@\') ? explode(\'@\', $route) : $route;\n"
	"            $result           = [\'type\' => \'method\', \'method\' => $method, \'var\' => $var];\n"
	"        } elseif (0 === strpos($route, \'@\')) {\n"
	"            // 路由到控制器\n"
	"            $route             = substr($route, 1);\n"
	"            list($route, $var) = self::parseUrlPath($route);\n"
	"            $result            = [\'type\' => \'controller\', \'controller\' => implode(\'/\', $route), \'var\' => $var];\n"
	"            $request->action(array_pop($route));\n"
	"            $request->controller($route ? array_pop($route) : Config::get(\'default_controller\'));\n"
	"            $request->module($route ? array_pop($route) : Config::get(\'default_module\'));\n"
	"            App::$modulePath = APP_PATH . (Config::get(\'app_multi_module\') ? $request->module() . DS : \'\');\n"
	"        } else {\n"
	"            // 路由到模块/控制器/操作\n"
	"            $result = self::parseModule($route, isset($option[\'convert\']) ? $option[\'convert\'] : false);\n"
	"        }\n"
	"        // 开启请求缓存\n"
	"        if ($request->isGet() && isset($option[\'cache\'])) {\n"
	"            $cache = $option[\'cache\'];\n"
	"            if (is_array($cache)) {\n"
	"                list($key, $expire, $tag) = array_pad($cache, 3, null);\n"
	"            } else {\n"
	"                $key    = str_replace(\'|\', \'/\', $pathinfo);\n"
	"                $expire = $cache;\n"
	"                $tag    = null;\n"
	"            }\n"
	"            $request->cache($key, $expire, $tag);\n"
	"        }\n"
	"        return $result;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 解析URL地址为 模块/控制器/操作\n"
	"     * @access private\n"
	"     * @param string $url     URL地址\n"
	"     * @param bool   $convert 是否自动转换URL地址\n"
	"     * @return array\n"
	"     */\n"
	"    private static function parseModule($url, $convert = false)\n"
	"    {\n"
	"        list($path, $var) = self::parseUrlPath($url);\n"
	"        $action           = array_pop($path);\n"
	"        $controller       = !empty($path) ? array_pop($path) : null;\n"
	"        $module           = Config::get(\'app_multi_module\') && !empty($path) ? array_pop($path) : null;\n"
	"        $method           = Request::instance()->method();\n"
	"        if (Config::get(\'use_action_prefix\') && !empty(self::$methodPrefix[$method])) {\n"
	"            // 操作方法前缀支持\n"
	"            $action = 0 !== strpos($action, self::$methodPrefix[$method]) ? self::$methodPrefix[$method] . $action : $action;\n"
	"        }\n"
	"        // 设置当前请求的路由变量\n"
	"        Request::instance()->route($var);\n"
	"        // 路由到模块/控制器/操作\n"
	"        return [\'type\' => \'module\', \'module\' => [$module, $controller, $action], \'convert\' => $convert];\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 解析URL地址中的参数Request对象\n"
	"     * @access private\n"
	"     * @param string $url 路由规则\n"
	"     * @param array  $var 变量\n"
	"     * @return void\n"
	"     */\n"
	"    private static function parseUrlParams($url, &$var = [])\n"
	"    {\n"
	"        if ($url) {\n"
	"            if (Config::get(\'url_param_type\')) {\n"
	"                $var += explode(\'|\', $url);\n"
	"            } else {\n"
	"                preg_replace_callback(\'/(\\w+)\\|([^\\|]+)/\', function ($match) use (&$var) {\n"
	"                    $var[$match[1]] = strip_tags($match[2]);\n"
	"                }, $url);\n"
	"            }\n"
	"        }\n"
	"        // 设置当前请求的参数\n"
	"        Request::instance()->route($var);\n"
	"    }\n"
	"\n"
	"    // 分析路由规则中的变量\n"
	"    private static function parseVar($rule)\n"
	"    {\n"
	"        // 提取路由规则中的变量\n"
	"        $var = [];\n"
	"        foreach (explode(\'/\', $rule) as $val) {\n"
	"            $optional = false;\n"
	"            if (false !== strpos($val, \'<\') && preg_match_all(\'/<(\\w+(\\??))>/\', $val, $matches)) {\n"
	"                foreach ($matches[1] as $name) {\n"
	"                    if (strpos($name, \'?\')) {\n"
	"                        $name     = substr($name, 0, -1);\n"
	"                        $optional = true;\n"
	"                    } else {\n"
	"                        $optional = false;\n"
	"                    }\n"
	"                    $var[$name] = $optional ? 2 : 1;\n"
	"                }\n"
	"            }\n"
	"\n"
	"            if (0 === strpos($val, \'[:\')) {\n"
	"                // 可选参数\n"
	"                $optional = true;\n"
	"                $val      = substr($val, 1, -1);\n"
	"            }\n"
	"            if (0 === strpos($val, \':\')) {\n"
	"                // URL变量\n"
	"                $name       = substr($val, 1);\n"
	"                $var[$name] = $optional ? 2 : 1;\n"
	"            }\n"
	"        }\n"
	"        return $var;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取路由解析缓存的key\n"
	"     * @param Request $request\n"
	"     * @return string\n"
	"     */\n"
	"    private static function getCheckCacheKey(Request $request)\n"
	"    {\n"
	"        static $key;\n"
	"\n"
	"        if (empty($key)) {\n"
	"            if ($callback = Config::get(\'route_check_cache_key\')) {\n"
	"                $key = call_user_func($callback, $request);\n"
	"            } else {\n"
	"                $key = \"{$request->host(true)}|{$request->method()}|{$request->path()}\";\n"
	"            }\n"
	"        }\n"
	"\n"
	"        return $key;\n"
	"    }\n"
	"}\n"
	"\n"
;
#endif